/**
 * create  by Jane
 * 查询用户相关信息接口
 */
import { getAction, postAction } from './manage'

/**
 * 查询当前机构的部门信息列表
 * @param params
 * @returns {Promise<null|*>}
 */
export async function  getDepartmentListByCustomerNumber(params) {
  let res = await getAction('/hc/customerDepartment/queryDepartmentIdTreeList',params);
  if(res && res.success){
      return res.result || [];
  }
  return [];
}

/**
 * 查询部门/科室  台账数据记录
 * @param params
 * @returns {Promise<*|*[]>}
 */
export async function  getDepartmentBookingStatistic(params) {
  let res = await getAction('/hc/hcDayParameterDepartmer/queryList',params);
  if(res && res.success){
      return res.result || [];
  }
  return [];
}

export async function  getDepartmentBookingStatisticByDate(params) {
  let res = await getAction('/hc/hcDayParameter/dayParameterStatistical',params);
  if(res && res.success){
      return res.result || [];
  }
  return [];
}

export async function  getEveryDayStatistic(params) {
  let res = await getAction('/hc/hcRecycleBagcode/submitInspection',params);
  if(res && res.success){
      return res.result || [];
  }
  return res;
}

export async function  getEveryDayStatisticV2(params) {
    let res = await getAction('/hc/hcRecycleBagcode/submitInspectionV2',params);
    if(res && res.success){
        return res.result || [];
    }
    return res;
}

export async function  submitInspectionByDay(params) {
  let res = await getAction('/hc/hcRecycleBagcode/submitInspectionByDay',params);
  if(res && res.success){
    return res.result || [];
  }
  return res;
}


export async function  submitDetails(params) {
    let res = await getAction('/hc/hcRecycleBagcode/submitDetails',params);
    if(res && res.success){
        return res.result || [];
    }
    return res;
}

/**
 * 根据医院编号查询部门信息
 * @param params {
 *     customerNumber
 * }
 * @returns {Promise<*|*[]>}
 */
export async function  getCustomerDepartmentByNumber(params) {
  let res = await getAction('/hc/customerDepartment/queryDepartmentIdTreeList',params);
  if(res && res.success){
      return res.result || [];
  }
  return [];
}

export async function  getCustomerListByName(params) {
    let res = await getAction('/hc/hcRecycleCustomerInfo/list',params);
    if(res && res.success){
        return  (res && res.result) ? res.result.records || [] : [];
    }
    return [];
}
